//
//  SEDepartmentAPI.swift
//  SmartEyeForPatient
//
//  Created by QDSG on 2021/4/25.
//

import Moya

enum SEDepartmentAPI {
    case listOfAllDepartments
}

extension SEDepartmentAPI: TargetType {
    var baseURL: URL { URL(string: SEApiManager.baseUrl)! }
    
    var path: String {
        switch self {
        case .listOfAllDepartments: return "/ng/newfuture-org/dict/listByMark"
        }
    }
    
    var method: Moya.Method {
        switch self {
        case .listOfAllDepartments:
            return .get
        }
    }
    
    var sampleData: Data { "".data(using: .utf8)! }
    
    var task: Task {
        SELog("\(path) - \(parameters)")
        switch self {
        case .listOfAllDepartments:
            return .requestParameters(parameters: parameters, encoding: URLEncoding.default)
        }
    }
    
    var headers: [String : String]? { SEApiManager.headers }
    
    private var parameters: [String: Any] {
        switch self {
        case .listOfAllDepartments:
            return ["mark": "org_dept"]
        }
    }
}
